From a578e1134643b4076c34675cad79499b48eb7387 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 23 Aug 2004 15:37:23 +0000 Subject: [PATCH] Fix #150822, reported by Christian Persch 2004-08-23 Matthias Clasen Fix #150822, reported by Christian Persch * gtk/gtklabel.c (gtk_label_ensure_layout): Set the layout width appropriately when ellipsized. (gtk_label_size_allocate): Only set the layout width if there is a layout. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtklabel.c | 12 +++++++++--- 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index be20df84d2..141a751952 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-08-23 Matthias Clasen + + Fix #150822, reported by Christian Persch + + * gtk/gtklabel.c (gtk_label_ensure_layout): Set the layout width + appropriately when ellipsized. + (gtk_label_size_allocate): Only set the layout width if there + is a layout. + 2004-08-23 Matthias Clasen * gdk/x11/gdkwindow-x11.c (gdk_window_focus): Support the latest diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index be20df84d2..141a751952 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2004-08-23 Matthias Clasen + + Fix #150822, reported by Christian Persch + + * gtk/gtklabel.c (gtk_label_ensure_layout): Set the layout width + appropriately when ellipsized. + (gtk_label_size_allocate): Only set the layout width if there + is a layout. + 2004-08-23 Matthias Clasen * gdk/x11/gdkwindow-x11.c (gdk_window_focus): Support the latest diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index be20df84d2..141a751952 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2004-08-23 Matthias Clasen + + Fix #150822, reported by Christian Persch + + * gtk/gtklabel.c (gtk_label_ensure_layout): Set the layout width + appropriately when ellipsized. + (gtk_label_size_allocate): Only set the layout width if there + is a layout. + 2004-08-23 Matthias Clasen * gdk/x11/gdkwindow-x11.c (gdk_window_focus): Support the latest diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index be20df84d2..141a751952 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2004-08-23 Matthias Clasen + + Fix #150822, reported by Christian Persch + + * gtk/gtklabel.c (gtk_label_ensure_layout): Set the layout width + appropriately when ellipsized. + (gtk_label_size_allocate): Only set the layout width if there + is a layout. + 2004-08-23 Matthias Clasen * gdk/x11/gdkwindow-x11.c (gdk_window_focus): Support the latest diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 8f40c18f90..900668a0a0 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1537,7 +1537,10 @@ gtk_label_ensure_layout (GtkLabel *label) pango_layout_set_alignment (label->layout, align); pango_layout_set_ellipsize (label->layout, label->ellipsize); - if (label->wrap) + if (label->ellipsize) + pango_layout_set_width (label->layout, + widget->allocation.width * PANGO_SCALE); + else if (label->wrap) { GtkWidgetAuxInfo *aux_info; gint longest_paragraph; @@ -1604,7 +1607,7 @@ gtk_label_ensure_layout (GtkLabel *label) pango_layout_set_width (label->layout, width); } } - else /* !label->wrap */ + else /* !label->wrap */ pango_layout_set_width (label->layout, -1); } } @@ -1687,7 +1690,10 @@ gtk_label_size_allocate (GtkWidget *widget, (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); if (label->ellipsize) - pango_layout_set_width (label->layout, allocation->width * PANGO_SCALE); + { + if (label->layout) + pango_layout_set_width (label->layout, allocation->width * PANGO_SCALE); + } if (label->select_info && label->select_info->window) { -- 2.30.2